using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EntLibEC.Cmn;
using EntLibEC.Biz.Online;

namespace EntLibEC.View.Basic
{
    public partial class CategoryCustomized : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            btnAdd.Attributes["onclick"] = "javascript:openWindowS2('CategoryCustomizedOpt.aspx?opt=new');return false;";
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            BindGrid();
        }

        private void BindGrid()
        {
            Hashtable paramHash = new Hashtable();
            if (txtCustCategorySysNo.Text.Trim() != string.Empty)
                paramHash.Add("SysNo", txtCustCategorySysNo.Text.Trim());
            if (txtParentSysNo.Text.Trim() != string.Empty)
                paramHash.Add("ParentSysNo", txtParentSysNo.Text.Trim());
            if (drpCategoryType.SelectedValue.ToString() != "0")
                paramHash.Add("CategoryType", drpCategoryType.SelectedValue);
            if (txtOriginalCategorySysNo.Text.Trim() != string.Empty)
                paramHash.Add("OriginCategorySysNo", txtOriginalCategorySysNo.Text.Trim());
            if (drpStatus.SelectedValue.Trim() != "all")
                paramHash.Add("Status", drpStatus.SelectedValue.Trim());
            if (drpPromotion.SelectedValue.Trim() != "all")
                paramHash.Add("PromotionStatus", drpPromotion.SelectedValue.Trim());

            //paramHash.Add("OrderBy", ddlOrderBy.SelectedItem.Value.ToString());

            DataSet ds = CategoryCustomizedManager.GetCustomizedCategoryList(paramHash);
            //base.SetDataGridPage(ds, grdCategory);
            grdCategory.DataSource = ds;
            grdCategory.DataBind();

            int rows = 0;
            if (Util.HasMoreRow(ds))
                rows = ds.Tables[0].Rows.Count;
            Assert(lblmsg, rows.ToString() + " record(s)", 1);
        }
    }
}
